#pragma once

#include "VConfigs.hpp"
#include "TetrisData.hpp"
#include "VPlayArea.hpp"

class Ctrl
{
public:
	static Ctrl * Get();

	void startGame();

	void nextTurn();

	void onGesture(GestureType type);

	void moveTetris(GestureType m);

	void syncTetris();

	void putTetris();

	void checkResult();

	void finishGame();

	void onUpdate(float);

	std::shared_ptr<VPlayArea> getCurrentViewPlay() {
		return m_view_play.lock();
	}
	
	void setCurrentViewPlay(std::shared_ptr<VPlayArea> view){
		m_view_play = view;
	}
protected:
	Tetris m_tetris;
	VConfigs m_g_config;
	std::weak_ptr<VPlayArea> m_view_play;

	bool m_is_running = false;
	bool m_is_touched = false;
	double m_update_time = 0.f;
	double m_down_time = 0.f;
	float m_down_interval = 0.5f;
//	std::shared_ptr<
};
